﻿<UserControl x:Class="Flare.Pages.Reports.NetworkMap"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             DataContext="{Binding RelativeSource={RelativeSource Self}}"
             xmlns:Controls="clr-namespace:Flare.Controls" 
             d:DesignHeight="300" d:DesignWidth="600">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.Resources>

            <Storyboard x:Key="StoryboardZoom" Storyboard.TargetName="root">
                <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleX)" 
                                                        From="1" To="{Binding TransScale, UpdateSourceTrigger=PropertyChanged}" Duration="0:0:0.1" />
                <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleY)" 
                                                        From="1" To="{Binding TransScale, UpdateSourceTrigger=PropertyChanged}" Duration="0:0:0.1" />
            </Storyboard>
            <Storyboard x:Key="StoryboardUnZoom" Storyboard.TargetName="root">
                <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleX)" 
                                                        To="1" Duration="0:0:0.1" />
                <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleY)" 
                                                        To="1" Duration="0:0:0.1" />
            </Storyboard>
        </Grid.Resources>
        <Grid.Triggers>
            <EventTrigger RoutedEvent="TextBlock.MouseEnter" SourceName="Zoomer">
                <BeginStoryboard Storyboard="{StaticResource StoryboardZoom}" x:Name="StoryboardZoom_BeginStoryboard" />
            </EventTrigger>
            <EventTrigger  RoutedEvent="TextBlock.MouseLeave" SourceName="Zoomer">
                <BeginStoryboard Storyboard="{StaticResource StoryboardUnZoom}" x:Name="StoryboardUnZoom_BeginStoryboard" />
            </EventTrigger>
        </Grid.Triggers>

        
        <StackPanel Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="{DynamicResource ColorText}">
            <TextBlock x:Name="AutoGenerateMap" HorizontalAlignment="Right" TextWrapping="Wrap" FontSize="10" Margin="4"
                       Foreground="{DynamicResource ColorGreyPastel}" Text="Генерировать" VerticalAlignment="Top" 
                       FontWeight="Bold" TextDecorations="Underline" PreviewMouseLeftButtonDown="AutoGenerateMap_PreviewMouseLeftButtonDown"/>
            
            <Image x:Name="hub" Source="/flare;component/Media/osa_hub.png" Stretch="None" MouseLeftButtonDown="hub_MouseLeftButtonDown"/>
            <Image  x:Name="vpn" Source="/flare;component/Media/osa_vpn.png" Stretch="None" MouseLeftButtonDown="vpn_MouseLeftButtonDown"/>
            <Image  x:Name="server" Source="/flare;component/Media/osa_server.png" Stretch="None" MouseLeftButtonDown="server_MouseLeftButtonDown"/>
            <Image x:Name="cloud"  Source="/flare;component/Media/osa_cloud.png" Stretch="None" MouseLeftButtonDown="cloud_MouseLeftButtonDown"/>

            <TextBlock x:Name="Save" HorizontalAlignment="Right" TextWrapping="Wrap" FontSize="10" Margin="4"
                       Foreground="{DynamicResource ColorGreyPastel}" Text="Экспорт в PNG" VerticalAlignment="Top" 
                       FontWeight="Bold" TextDecorations="Underline" PreviewMouseLeftButtonDown="Save_MouseLeftButtonDown"/>
        </StackPanel>

        <ScrollViewer x:Name="rootScroll" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="1">
            <Grid x:Name="root" VerticalAlignment="Top" HorizontalAlignment="Left" Drop="root_Drop" Background="Transparent" AllowDrop="True"
				PreviewMouseRightButtonUp="root_PreviewMouseLeftButtonUp" PreviewMouseRightButtonDown="root_PreviewMouseLeftButtonDown">
                <Grid.Style>
                    <Style>
                        <Setter Property="Grid.LayoutTransform">
                            <Setter.Value>
                                <ScaleTransform ScaleX="1" ScaleY="1"/>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Grid.Style>
            </Grid>
        </ScrollViewer>

        <TextBlock x:Name="Zoomer" HorizontalAlignment="Right" FontSize="18" Margin="4,4,20,0" Grid.Column="1"
                       Foreground="{DynamicResource ColorText}" Text="Обозреть владения" VerticalAlignment="Top" FontWeight="Bold" TextDecorations="Underline"/>
    </Grid>
</UserControl>
